package entity;

import java.util.Date;

public class Ticket {
    int ticketId;
    int trainId;
    int userId;
    String seatType;
    String seatNumber;

    Date purchaseTime;
    String status;
    String logicDelete;

    Train train;
    Seat seat;


    public int getTicketId() {
        return ticketId;
    }

    public void setTicketId(int ticketId) {
        this.ticketId = ticketId;
    }

    public int getTrainId() {
        return trainId;
    }

    public void setTrainId(int trainId) {
        this.trainId = trainId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getSeatType() {
        return seatType;
    }

    public void setSeatType(String seatType) {
        this.seatType = seatType;
    }

    public String getSeatNumber() {
        return seatNumber;
    }

    public void setSeatNumber(String seatNumber) {
        this.seatNumber = seatNumber;
    }

    public Date getPurchaseTime() {
        return purchaseTime;
    }

    public void setPurchaseTime(Date purchaseTime) {
        this.purchaseTime = purchaseTime;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getLogicDelete() {
        return logicDelete;
    }

    public void setLogicDelete(String logicDelete) {
        this.logicDelete = logicDelete;
    }

    public Seat getSeat() {
        return seat;
    }

    public void setSeat(Seat seat) {
        this.seat = seat;
    }

    public Train getTrain() {
        return train;
    }

    public void setTrain(Train train) {
        this.train = train;
    }

    @Override
    public String toString() {
        return "Ticket{" +
                "ticketId=" + ticketId +
                ", trainId=" + trainId +
                ", userId=" + userId +
                ", seatType='" + seatType + '\'' +
                ", seatNumber='" + seatNumber + '\'' +
                ", purchaseTime=" + purchaseTime +
                ", status='" + status + '\'' +
                ", logicDelete='" + logicDelete + '\'' +
                ", seat=" + seat +
                '}';
    }

    public String show(){
        if (train == null) {
            return "车票信息未初始化，train对象为null";
        }
        return seatType+"票"+"\n"+
                "座位类型："+seatType+"\t"+
                "座位号："+seatNumber+"\t"+
                "票状态："+status+"\n"+
                "车次："+train.getTrainName()+"\t"+
                "出发时间："+train.getDepartureTime()+"\t"+
                "到达时间："+train.getArrivalTime()+"\t"+
                "始发站："+train.getStartStation()+"\t"+
                "终点站："+train.getEndStation()+"\n"
                +"****************************************************";
    }

}
